
#!/bin/bash

sudo git clone https://gitee.com/eric010101/LAMP2021 /root/LAMP2021/

sudo apt update
sudo apt upgrade -y

mkdir pyipfs
cd pyipfs
sudo pip3 install --upgrade setuptools

pip3 install web3
pip3 install ipfshttpclient
pip3 install Werkzeug
pip3 install Flask
pip3 install Flask-SocketIO
pip3 install Flask-Bootstrap
pip3 uninstall python-socketio -y
pip3 install python-socketio

cd 
wget https://dist.ipfs.io/go-ipfs/v0.7.0/go-ipfs_v0.7.0_linux-amd64.tar.gz
tar -xvzf go-ipfs_v0.7.0_linux-amd64.tar.gz
cd go-ipfs
sudo bash install.sh
ipfs --version
ipfs init
ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080

cp /root/LAMP2021/ipfs_new.service /lib/systemd/system/ipfs.service
cp /root/LAMP2021/http-ipfs-web3-poa-20210703.py /root/pyipfs/ipfs2bc.py
cp /root/LAMP2021/ipfs2bc-py-poa-20210703.service /lib/systemd/system/ipfs2bc.service

sudo systemctl enable ipfs.service
sudo systemctl enable ipfs2bc.service
sudo systemctl start ipfs.service
sudo systemctl start ipfs2bc.service
